package com.zzx.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
@LoadBalancerClients({
        @LoadBalancerClient(name = "PROVIDER-USER", configuration = CustomLoadBalancerConfiguration.class),
        @LoadBalancerClient(name = "PROVIDER-GOODS", configuration = CustomLoadBalancerConfiguration.class),
        @LoadBalancerClient(name = "PROVIDER-ORDER", configuration = CustomLoadBalancerConfiguration.class),
})
public class ConfigBean
{
    @LoadBalanced //配置负载均衡实现RestTemplate
    @Bean
    public RestTemplate getRestTemplate()
    {
        return new RestTemplate();
    }

}
